package com.adam.zk.controller;

import com.adam.zk.service.DubboService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/consumer")
public class ConsumerController {

    @Reference
    private DubboService dubboService;

    @GetMapping("/findPhone/{phoneNum}")
    public String findName(@PathVariable("phoneNum") String phoneNum) {
        return dubboService.getPhoneNum(phoneNum);
    }

    @GetMapping("/findTotal/{total}")
    public int findTotal(@PathVariable("total") int total) {
        return dubboService.getTotal(total);
    }
}
